package tests;

import org.junit.Test;

import peerToPeerFacebook.proj.ArgumentValidator;

/**
 * Unittests for ArgumentValidator class
 */
public class ArgumentValidatorTests {

	@Test(expected=IllegalArgumentException.class)
	public void IsGreaterThan_WhenArgLessThanMin_Throws() 
	{
		ArgumentValidator.IsGreaterThan("testArg", 5, 10);
	}
	
	@Test(expected=IllegalArgumentException.class)
	public void IsGreaterThan_WhenArgEqualsMin_Throws() 
	{
		ArgumentValidator.IsGreaterThan("testArg", 5, 5);
	}	
	
	@Test
	public void IsGreaterThan_WhenArgGreaterThanMin_DoesNotThrow() 
	{
		ArgumentValidator.IsGreaterThan("testArg", 5, 1);
	}
	
	@Test(expected=IllegalArgumentException.class)
	public void IsLessThan_WhenArgGreaterThanMax_Throws() 
	{
		ArgumentValidator.IsLessThan("testArg", 10, 5);
	}
	
	@Test(expected=IllegalArgumentException.class)
	public void IsLessThan_WhenArgEqualsMax_Throws() 
	{
		ArgumentValidator.IsLessThan("testArg", 5, 5);
	}	
	
	@Test
	public void IsLessThan_WhenArgLessThanMax_DoesNotThrow() 
	{
		ArgumentValidator.IsLessThan("testArg", 5, 10);
	}
	
	@Test(expected=IllegalArgumentException.class)
	public void IsNotNull_WhenArgIsNull_Throws() 
	{
		ArgumentValidator.IsNotNull("testArg", null);
	}
	
	@Test(expected=IllegalArgumentException.class)
	public void IsNotNullOrEmpty_WhenArgIsNull_Throws() 
	{
		ArgumentValidator.IsNotNullOrEmpty("testArg", null);
	}	
	
	@Test(expected=IllegalArgumentException.class)
	public void IsNotNullOrEmpty_WhenArgIsEmpty_Throws() 
	{
		ArgumentValidator.IsNotNullOrEmpty("testArg", "");
	}		

}
